home *** CD-ROM | disk | FTP | other *** search
/ Mac Magazin/MacEasy 25 / Mac Magazin and MacEasy Magazine CD - Issue 25.iso / Grafik & Text / Alpha / Tcl / UserCode / electricEnter.tcl < prev    next >
Text File  |  1996-08-15  |  2KB  |  70 lines

  1. # FILE: electricEnter.tcl
  2. #
  3. # LAST UPDATE: 01/06/93 6:52:23 AM
  4. #
  5. # This file contains the following TCL procedure(s):
  6. #
  7. #     electricEnter -- similar to MPW ENTER key functionality
  8. #
  9. #    This Alpha TCL proc (bound to Enter key) provides MPW like execution of
  10. #    TCL commands.
  11. #
  12. #    Results are inserted into the window just like MPW.  Sort of like Shell
  13. #    mode in a regular text window.
  14. #
  15. #    To use, simply place this file in the a folder named $HOME:Tcl:Usercode:
  16. #    add 'source $HOME:Tcl:Usercode:electricEnter.tcl' to AlphaBits.tcl.
  17.  
  18. # COPYRIGHT:
  19. #
  20. #    Copyright © 1992,1993 by David C. Black
  21. #    All rights reserved.
  22. #
  23. #    Redistribution and use in source and binary forms are permitted
  24. #    provided that the above copyright notice and this paragraph are
  25. #    duplicated in all such forms and that any documentation,
  26. #    advertising materials, and other materials related to such
  27. #    distribution and use acknowledge that the software was developed
  28. #    by David C. Black.
  29. #
  30. #    THIS SOFTWARE IS PROVIDED "AS IS" AND WITHOUT ANY EXPRESS OR
  31. #    IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED
  32. #    WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
  33. #
  34. ################################################################################
  35.  
  36. # AUTHOR
  37. #
  38. #    David C. Black
  39. #    Internet: black@mpd.tandem.com (preferred)
  40. #    GEnie:    D.C.Black
  41. #    USnail:   6217 John Chisum Lane, Austin, TX 78749
  42. #
  43. ################################################################################
  44.  
  45. # HISTORY
  46. #                  
  47. # modified who rev reason
  48. # -------- --- --- ------
  49. # 01/06/93 DCB 1.0 Original
  50.  
  51. proc electricEnter {} {
  52.     global _text
  53.     global _returnText
  54.     set window [lindex [winNames] 0]
  55.     endOfLine
  56.     set _text [getText [lineStart [getPos]] [getPos]]
  57.     set errcode [uplevel #0 {catch $_text _returnText}]
  58.     bringToFront $window
  59.     if {$errcode != 0} {
  60.         set _returnText "ERROR $errcode: $_returnText"
  61.     }
  62.     insertText -w $window "\r$_returnText"
  63. }
  64. #endproc electricEnter
  65. ################################################################################
  66.  
  67. bind Enter electricEnter
  68. ################################################################################
  69.  
  70.